package com.iee.guava.map;

import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.TreeMultimap;

import java.util.Collection;

/**
 *@ClassName map
 *@Description TODO
 *@Author longxiaonan@163.com
 *@Date 2022/5/6 0006 11:39
 */
public class MapDemo {
    public static void main(String[] args){
        //按自然序访问插入的元素
//        Multimap<String, String> map = TreeMultimap.create();
        //按照插入顺序访问插入的元素
        Multimap<String, String> map = LinkedHashMultimap.create();
        map.put("aa", "a1");
        map.put("aa", "a2");
        map.put("bb", "b1");
        map.put("bb", "b2");
        map.put("bb", "b3");
        System.out.println(map);
        Collection<String> aa = map.get("aa");
        System.out.println(map.keySet());
    }
}
